<template>
  <view>
    <view class="details-Top">
      <image :src="list.image" mode="aspectFill"></image>
      <view class="details-price">
        <text>¥{{ list.price }}</text>
        <text>已约{{ list.sales }}</text>
      </view>
      <text class="details-Title">{{ list.title }}</text>
    </view>
    <!-- 预约时段 -->
    <view class="nucleic-time">
      <text class="nucleic-Title">体检时间选择</text>
      <scroll-view scroll-x="true" class="scroll-view_H">
        <view class="nucleic-time-flex">
          <block>
            <view v-for="(item,index) in list.date" :class="item.date===flag?'a':''" :key="index"
                  @click="sj(item.date)">
              <text>{{ item.date }}</text>
              <text>{{ item.week }}</text>
            </view>
          </block>
        </view>
      </scroll-view>
    </view>
    <!-- 适用人群 -->
    <view class="nucleic-time">
      <text class="nucleic-Title">适用人群</text>
      <view class="nucleic-crowd">
        <block>
          <view v-for="(item,index) in list.crowd" :key="index">
            <image style="width: 50px;height: 50px" :src="item.image" mode="aspectFill"></image>
            <text>{{ item.name }}</text>
          </view>
        </block>
      </view>
    </view>
    <!-- 套餐项目 -->
    <view class="nucleic-time">
      <view class="nucleic-Title">套餐项目</view>
      <view class="project-view" v-for="(item,index) in list.project" :key="index">
        <block>
          <text class="project-Title">{{ item.title }}</text>
          <view class="project-card" v-for="(it,key) in item.content" :key="key">
            <view>{{ it.thing }}</view>
            <view>{{ it.details }}</view>
          </view>
        </block>
      </view>
    </view>
    <!-- 提交 -->
    <view style="height:150px"></view>
    <view class="Total-view">
      <text>检测费用：¥{{ list.price }}</text>
      <text @click="add">选择成员</text>
    </view>
    <loding :show="show" @qie="add" :cart="cart" :obj="obj"></loding>
  </view>
</template>

<script>
import {phydateil} from "../../utils/API/homeapi";
import loding from "../../components/loding/loding";

export default {
  components: {loding},
  data() {
    return {
      show: false,
      list: {},
      cart: {},
      flag: null,
      obj: {
        phy_name: '',
        phy_time: "",
        patient_id: ""
      }
    };
  },
  async onLoad(o) {
    let {data} = await phydateil(o.id)
    this.list = data[0]
    this.obj.phy_name = data[0].title
  },
  onShow() {
    console.log(111)
    this.cart = this.store.state.obj
    this.obj.patient_id = this.store.state.obj._id
  },
  methods: {
    add() {
      this.show = !this.show
    },
    sj(item) {
      this.obj.phy_time = item
      this.flag = item
    }
  }
}
</script>

<style lang="scss" scoped>
/* 表单提交 */
@import url('../../static/common-style/form.css');
/* 预约时间段 */
@import url('../../static/common-style/nucleic-time.css');

page {
  background-color: #fafafa;
}

/* 顶部 */
.details-Top {
  background-color: #ffffff;
}

.details-Top image {
  width: 100%;
  height: 400rpx;
  display: block;
}

.details-price {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20rpx;
}

.details-price text:nth-child(1) {
  font-size: 35rpx;
  font-weight: bold;
  color: #ff5f2c;
}

.details-Title {
  padding: 0 0 20rpx 20rpx;
  display: block;
  font-weight: bold;
  font-size: 35rpx;
}

/* 适用人群 */
.nucleic-crowd {
  display: flex;
  justify-content: space-between;
  padding-top: 20rpx;
}

.nucleic-crowd view {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.nucleic-crowd image {
  width: 100rpx;
  height: 100rpx;
  display: block;
  margin-bottom: 10rpx;
  border-radius: 10rpx;
}

/* 套餐项目 */
.project-Title {
  background-color: #f0f2f8;
  display: block;
  border-radius: 10rpx;
  font-weight: bold;
  text-align: center;
  padding: 20rpx 0;
  margin: 20rpx 0;
}

.project-card {
  display: flex;
  flex-wrap: wrap;
}

.project-card view {
  margin: 5rpx;
  background-color: #f0f2f8;
  border-radius: 10rpx;
  padding: 20rpx 10rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-card view:nth-child(1) {
  width: 200rpx;
  margin-left: auto;
}

.project-card view:nth-child(2) {
  flex: 1;
  margin-right: auto;
}

/* 选中加上样式 */
.checkstyle {
  background-color: #2c76ef !important;
  color: #ffffff !important;
}
</style>
